﻿<%@ Page MasterPageFile="~/UI/My.Master" Language="C#" AutoEventWireup="true" CodeBehind="OrderList.aspx.cs" Inherits="RabbitShop.UI.OrderList" %>
<%@ Import Namespace="Rabbit.Logic" %>

<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">
    <form id="form1" action="/Action/abc.aspx?aid=" method="POST">

        <script type="text/javascript">

            form1.onsubmit = function (e) {
                // stop the regular form submission
                e.preventDefault();

                // collect the form data while iterating over the inputs
                var data = {};
                for (var i = 0, ii = form1.length; i < ii; ++i) {
                    var input = form1[i];
                    if (input.name) {
                        data[input.name] = input.value;
                    }
                }

                // construct an HTTP request
                var xhr = new XMLHttpRequest();
                xhr.open(form1.method, form1.action, true);
                xhr.setRequestHeader('Content-Type', 'application/json; charset=UTF-8');

                // send the collected data as JSON
                xhr.send(JSON.stringify(data));

                xhr.onloadend = function () {
                    // done
                    if (xhr.responseText == "true") {
                        window.location = "/UI/UserAddress.aspx";
                    } else {
                        alert(xhr.responseText);
                    }
                };
            };
        </script>

        


        <table>
    
    <asp:Repeater runat="server" ID="myRepeater" >
        <ItemTemplate>
            
            <tr>
                <td>
                    <div style="border-top: 2px solid #e2e2e2;">
                        <table>
                            <tr >
                                <td colspan="3">
                                    <%#Eval("OrderInfo.OrderedAt") %> &nbsp;&nbsp;&nbsp;&nbsp; 订单号：
                                    <a href="/UI/OrderHistory.aspx?id=<%#Eval("OrderInfo.Id") %>"><%#Eval("OrderInfo.Id") %> </a> 
                                </td>
                                
                                <td colspan="2">
                                    <a href="ProductListByShop.aspx?shopId=<%#Eval("ShopInfo.ShopId") %>"><%#Eval("ShopInfo.NickName") %></a>
                                </td>
                                <td>
                                    <%#Eval("OrderInfo.ShipTo.Province") %> <%#Eval("OrderInfo.ShipTo.City") %> <%#Eval("OrderInfo.ShipTo.Region") %> <%#Eval("OrderInfo.ShipTo.Detail") %>
                                </td>
                                <td>
                                    <%# ((OrderState)Eval("OrderInfo.State")).ToDescription() %>
                                </td>
                                <td>
                                    <%#Eval("OrderInfo.FinalPrice") %>
                                </td>
<%--                                <td>
                                    <%#Eval("OrderInfo.Total.TotalPrice") %>
                                </td>
                            
                                <td>
                                    <%#Eval("OrderInfo.DiliveryPrice") %>
                                </td>
                                <td>
                                    <%#Eval("OrderInfo.FinalPrice") %>
                                </td>--%>
                                
                            </tr>
                            
                    <asp:Repeater runat="server" ID="productRepeater">
                        <ItemTemplate>
                            
                            <tr>
                                <td>
                                    <a href="ProductDetail.aspx?id=<%#Eval("Product.ProductId") %>" target="_blank" >
                                        <img alt="产品图片" width="80" height="80" src="/Images/accent.png" />
                                    </a>
                                </td>
                                <td style="width: 50px;">
                                    <%#Eval("Product.Name") %>
                                </td>
                                <td style="width: 200px;">
                                    <div>
                                        <%#Eval("Product.Title") %>
                                    </div>
                                    <div>
                                        <%#Eval("Product.SubTitle") %>
                                    </div>
                                </td>
                                <td style="width: 80px;">
                                    <%#Eval("Product.PricePerUnit") %>
                                </td>
                                <td style="width: 40px;">
                                    <%#Eval("Quantity") %>
                                </td>
                                <td style="width: 100px;">
                                    <%#(decimal)Eval("Product.PricePerUnit") * (int)Eval("Quantity") %>
                                </td>
                                
                            </tr>

                        </ItemTemplate>
                    </asp:Repeater>
                        </table>
                    </div>
                </td>
            </tr>
            
        </ItemTemplate>
    </asp:Repeater>
                
        </table>

    </form>
    
</asp:Content>
